Skip to content

add cloudsync-wasm build#5

Merged
marcobambini merged 41 commits intomainfrom
wasm-build
Jul 6, 2025
Merged

add cloudsync-wasm build#5
marcobambini merged 41 commits intomainfrom
wasm-build

Conversation

@Gioee
Copy link
Member

@Gioee Gioee commented Jul 4, 2025

No description provided.

Gioee and others added 30 commits June 25, 2025 13:38
…of double quotes in query strings for wasm support
@Gioee Gioee requested review from andinux and marcobambini July 4, 2025 12:24
@Gioee Gioee self-assigned this Jul 4, 2025
@Gioee Gioee added the enhancement New feature or request label Jul 4, 2025
Copy link
Member

@marcobambini marcobambini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of the requested changes:

  • Double quotes must be used for identifiers.
  • WASM specific network code must be in a separate network_wasm.c file (like network.m for objc specific code)

// MARK: - Utils -

#ifndef CLOUDSYNC_OMIT_CURL
#ifdef SQLITE_WASM_EXTRA_INIT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have the wasm-related network code in a separate file. We have network.m for objc; we could have network_wasm.c, with the three network functions.

@@ -137,18 +137,18 @@ char *build_changes_sql (sqlite3 *db, const char *idxs) {
"changes_query AS ( "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

col_name and table_name are identifiers so they must be quoted in double quotes

// the good news is that the query can be computed in SQLite without the need to do any extra computation from the host language
const char *sql = "WITH table_names AS ("
"SELECT format(\"%w\", name) as tbl_name "
"SELECT format('%w', name) as tbl_name "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, identifiers like table names must be quoted in double quotes.

// according to the following rules in the order shown:
// 1. If the declared type contains the string "INT" then it is assigned INTEGER affinity.
sql = sqlite3_snprintf((int)blen, buffer, "SELECT count(*) FROM pragma_table_info('%w') WHERE pk=1 AND \"type\" LIKE \"%%INT%%\";", name);
sql = sqlite3_snprintf((int)blen, buffer, "SELECT count(*) FROM pragma_table_info('%w') WHERE pk=1 AND \"type\" LIKE '%%INT%%';", name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is right because %%INT%% is a literal

@marcobambini marcobambini merged commit c2e0a1f into main Jul 6, 2025
19 of 20 checks passed
@Gioee Gioee deleted the wasm-build branch July 7, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants